package edu.xhu.behavior.feign;

import edu.xhu.behavior.service.BiliUserCommentService;
import edu.xhu.model.behavior.dto.AddCommentDto;
import edu.xhu.model.behavior.dto.RootCommentDto;
import edu.xhu.model.behavior.dto.SonCommentDto;
import edu.xhu.model.common.dtos.ResponseResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.apache.ibatis.annotations.Param;
import org.springframework.web.bind.annotation.*;

@Api(value = "commentController", tags = "commentController")
@CrossOrigin
@RestController
@RequiredArgsConstructor
@RequestMapping("/comment")
public class CommentApiController {

    private final BiliUserCommentService biliUserCommentService;

    @PostMapping("/rootComment")
    @ApiOperation("api-返回视频的热度评论")
    public ResponseResult<?> queryRootCommentsByVideoIds(@RequestBody RootCommentDto rootCommentDto) {
        return biliUserCommentService.queryRootCommentsByVideoIds(rootCommentDto);
    }

    @PostMapping("/rootCommentIdsByVideoId")
    @ApiOperation("api-根据videoId返回所有根评论id")
    public ResponseResult<?> queryRootCommentIdsByVideoId(@RequestBody RootCommentDto rootCommentDto) {
        return biliUserCommentService.queryRootCommentIdsByVideoId(rootCommentDto);
    }

    @PostMapping("/rootCommentByCommentIds")
    @ApiOperation("api-根据commentIds返回根评论")
    public ResponseResult<?> queryRootCommentsByCommentIds(@RequestBody RootCommentDto rootCommentDto) {
        return biliUserCommentService.queryRootCommentsByCommentIds(rootCommentDto);
    }

    @PostMapping("/sonComment")
    @ApiOperation("api-返回根评的所有子评")
    public ResponseResult<?> querySonCommentsByRootIds(@RequestBody SonCommentDto sonCommentDto) {
        return biliUserCommentService.querySonCommentsByRootIds(sonCommentDto);
    }

    @PostMapping("/addComment")
    @ApiOperation("api-添加评论api")
    public ResponseResult<?> addComment(@RequestBody AddCommentDto addCommentDto) {
        return biliUserCommentService.addComment(addCommentDto);
    }

}